﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QLNS_v1.Bus
{
   public class LuongCB_Bus
    {
       NhanVienContextDataContext nhanvien = new NhanVienContextDataContext();
       public List<Option> ListLuongCB()
       {
           var lcb = from l in nhanvien.Options select l;
           return lcb.ToList<Option>();
       }
       public bool Update(Option luong)
       {
           try
           {
               var query = nhanvien.Options.Single(p => p.OptionID == luong.OptionID);
               query.OptionID = luong.OptionID;
               query.LuongCoBan = luong.LuongCoBan;
               query.Ngay = luong.Ngay;
               nhanvien.SubmitChanges();
               return true;
           }
           catch
           {
               return false;
           }
       }
    }
}
